unit fmAddCardRange;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, MemDS, DBAccess, MSAccess, cxGraphics, cxControls,
  cxLookAndFeels, cxLookAndFeelPainters, cxStyles, cxCustomData, cxFilter,
  cxData, cxDataStorage, cxEdit, cxDBData, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses,
  cxGridCustomView, cxGrid, cxDBLookupComboBox, wwSpeedButton,
  wwDBNavigator, ExtCtrls, wwclearpanel, cxTimeEdit, cxTextEdit, cxCalendar;

type
  TAddCardRangeForm = class(TForm)
    tblCardRange: TMSTable;
    srcCardRange: TDataSource;
    tblStation: TMSTable;
    srcStation: TDataSource;
    wwDBNavigator1: TwwDBNavigator;
    wwDBNavigator1First: TwwNavButton;
    wwDBNavigator1Prior: TwwNavButton;
    wwDBNavigator1Next: TwwNavButton;
    wwDBNavigator1Last: TwwNavButton;
    wwDBNavigator1Insert: TwwNavButton;
    wwDBNavigator1Delete: TwwNavButton;
    wwDBNavigator1Post: TwwNavButton;
    wwDBNavigator1Refresh: TwwNavButton;
    wwDBNavigator1Cancel: TwwNavButton;
    srcSpeCard: TDataSource;
    qrySpecard: TMSQuery;
    cxGrid2: TcxGrid;
    tvSpeCard: TcxGridDBTableView;
    glSpeCard: TcxGridLevel;
    tvCard: TcxGridDBTableView;
    glCard: TcxGridLevel;
    cxGrid1: TcxGrid;
    tvCardCARDID: TcxGridDBColumn;
    tvCardENSTATION: TcxGridDBColumn;
    tvCardEXSTATION: TcxGridDBColumn;
    tvCardBegDT: TcxGridDBColumn;
    tvCardEndDT: TcxGridDBColumn;
    tvSpeCardCARDNO: TcxGridDBColumn;
    tvSpeCardAccountNo: TcxGridDBColumn;
    tvSpeCardVehPlate: TcxGridDBColumn;
    tvSpeCardVehClass: TcxGridDBColumn;
    tvSpeCardTypeName: TcxGridDBColumn;
    tvSpeCardAccountName: TcxGridDBColumn;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure tblCardRangeBeforePost(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  AddCardRangeForm: TAddCardRangeForm;

implementation

uses
  fmMain;

{$R *.dfm}

procedure TAddCardRangeForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
   tblStation.Close;
   tblcardRange.Close;
   qrySpecard.Close;
   Action := caFree;
end;

procedure TAddCardRangeForm.FormCreate(Sender: TObject);
begin
   tblStation.Open;
   tblcardRange.Open;
   qrySpecard.Open;
end;

procedure TAddCardRangeForm.tblCardRangeBeforePost(DataSet: TDataSet);
var
   vDate: string;
begin
   vDate := tblCardRange.FieldByName('EndDT').AsString;
   vDate := vDate + ' 23:59:59';
   tblCardRange.FieldByName('EndDT').AsString := vDate;
end;

end.
